/**
 * 
 */
package org.cuatrovientos.facture;

import static org.junit.Assert.*;

import org.junit.Test;

/**
 * @author teodor_mivovan
 *
 */
public class FactureTest {

	/**
	 * Test method for {@link org.cuatrovientos.facture.Facture#Facture(double)}.
	 */
	@Test
	public void testFacture() {
		Facture myFacture = new Facture(66.6d);
		double target = myFacture.getSubtotal();
		double expected = 66.6d;
		
		assertEquals("Constructor test", target,expected,0.0);
	}

	/**
	 * Test method for {@link org.cuatrovientos.facture.Facture#Add_iva()}.
	 */
	@Test
	public void testAdd_iva() {
		Facture myFacture = new Facture(66.6d);
		myFacture.Add_iva();
		double target = myFacture.getTotal();
		double expected = 80.586d;
		assertEquals("Test reduced iva", target,expected,0.0);
	}

	/**
	 * Test method for {@link org.cuatrovientos.facture.Facture#Add_reducedIva()}.
	 */
	@Test
	public void testAdd_reducedIva() {
		Facture myFacture = new Facture(66.6d);
		myFacture.Add_reducedIva();
		double target = myFacture.getTotal();
		double expected = 69.264d;
		assertEquals("Test reduced iva", target,expected,0.0);
	}

	/**
	 * Test method for {@link org.cuatrovientos.facture.Facture#Reduce_Discount()}.
	 */
	@Test
	public void testReduce_Discount() {
		Facture myFacture = new Facture(66.6d);
		myFacture.Reduce_Discount();
		double target = myFacture.getTotal();
		double expected = 59.94d;
		assertEquals("Test reduced iva", target,expected,0.0);;
	}

}
